
import time
import random
from bs4 import BeautifulSoup
# from curl_cffi.requests import Session
import requests

# s = Session()

# 配置请求头（必须更新Cookie！）
headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36",
    "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
    "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8",
    "Referer": "https://www.jd.com/",
    "Connection": "keep-alive",
    "Upgrade-Insecure-Requests": "1",
    "Sec-Fetch-Mode": "navigate",
    "Sec-Fetch-Site": "same-origin",
    "Sec-Fetch-Dest": "document",
    "cookie":"__jdu=175628082811923751328; shshshfpa=2f4e14b3-9d91-0ec7-d206-c3b6c464064b-1756535886; shshshfpx=2f4e14b3-9d91-0ec7-d206-c3b6c464064b-1756535886; mt_xid=V2_52007VwMUVlpbW1sWShBcBW8AEFRZWFBZFnkeCwAyAhpQVEQFCUodBVkAZlcOW1VfUEYXHktcUGUHQFdaCFBqHEgaWBlnAg5QXElSXBRLEVcEbjMQYl1oVlsWQBtdAmQEElRtW1VT; areaId=7; ipLoc-djd=7-412-416-47178; jcap_dvzw_fp=JZ2u9x-5qn7EiJk5WoSlKYaPKES0WIhtvLZTgSNJBNcH5yE-pPCC_gziijAgfbMHhkdXy1SCHHlUtYAuQnr4Vyj55QY=; pinId=94EefYleEEjbo9JEpX06AA; pin=jd_fjzUwuLpOpVq; unick=ix2220cfpa3cli; _tp=RZdK5pSH0lOKEVgz6%2F%2B%2FyA%3D%3D; _pst=jd_fjzUwuLpOpVq; unpl=JF8EAMZnNSttWEwBVUkCTxZFGF8AW1QPGB9UPWcBXA1fHAcMSwAYEkJ7XlVdWRRLFx9uYhRUXlNJUw4eAisSEXteXVdZDEsWC2tXVgQFDQ8VXURJQlZAFDNVCV9dSRZRZjJWBFtdT1xWSAYYRRMfDlAKDlhCR1FpMjVkXlh7VAQrAh0WF0hUVVdeAUsXC2xlA1BdWkhdNRoyHCIge1pVWlUIQicCX2Y1FgkETFAAHwMTXxBNWVNdVAlCFApvZw1XX15PVAcYCysTIEg; mba_muid=175628082811923751328; __jdv=70901841|baidu-pinzhuan|t_288551095_baidupinzhuan|cpc|0f3d30c8dba7459bb52f2eb5eba8ac7d_0_16dac1e5db3e486b9fc159a6fb8a321c|1762248418495; joyya=0.1762248419.27.0xe1kn5; TrackID=1n80dqZ3ISLcz2wwUqcFaYQXcuRKpfkTn3hFEvz4L24BhFUwZDinz0ZYnuxM_q25MI6htVsBTwaHkpN2uyyT1bc3k78SNjhnNYUiwXMuWktA; thor=D8F6A3ED163C136451BAE01FD1BD700F5CB74EE5CC2473A90304ED35F7DD8E94E88CAED469CF29BC6FB073E85E72C8291AF39062CC0ACB2EE0DE0E13281965F4C0E489E9200DB7A295B08A32BEB40BE0AEFB32B2E99E4F33DFBFB980B4B928B5BBF0A43EA7D4AA268F1C85998E2FDF97B9AE11AB419E97C171AFCDB85E0BF868BCA4473BF04FBE3D8DAEF6D7E84E425F4FBC2BC7088F37C8B6B78E91F16CFE15; light_key=AASBKE7rOxgWQziEhC_QY6yaq4NYtRsSOX5n6lUWWZ52wt3OKuxpEmtYLZ_85TKAKfNkV1WT; __jdc=143920055; 3AB9D23F7A4B3C9B=X7JXFWBZNZFJ3FUNHOR63PXBLGVQ5R5G7NRQFWCTXJ6ARQSL2XWQBGDERCM3VPT727EAT5G2YFMMCMGIKIXLLEMGU4; flash=3_2U2YhaFUoYLbrygfF8hrJRCNddyYYfVpgDjGn6AtKQVa2wrLH9gH57rpypQucfsOL097-_5iDXb4OZfzy_4VsbTfw_kAY9DwwH5tWl2en7kdZaBisXWXwJVhREUmczTkpQ3GNH75XpnFEfbNG3-s2ZczgHNaLLlmnyFj5srOd1hX2CyHthS3; __jda=143920055.175628082811923751328.1756280828.1762312484.1762314443.14; 3AB9D23F7A4B3CSS=jdd03X7JXFWBZNZFJ3FUNHOR63PXBLGVQ5R5G7NRQFWCTXJ6ARQSL2XWQBGDERCM3VPT727EAT5G2YFMMCMGIKIXLLEMGU4AAAAM2KIQVANAAAAAAC446GTPFHKFJU4X; _gia_d=1; __jdb=143920055.5.175628082811923751328|14.1762314443; sdtoken=AAbEsBpEIOVjqTAKCQtvQu17yQGcDCekFsbxyg536hWZsvEBGpwk2pRkzvwGs1hpEWCmAWPQeUtVQs9ypmVAWrt0I_0kC6-rNDoef53sGmiN8LbxCbMwfO9iphjBxdEe9i6k_H0zVV_KEu4fKJX1nQ-z; shshshfpb=BApXWHMUpUf9AuLqjb9bgc2DPqsF_oreRBhQSX6lr9xJ1PdZfQoDciC_8mQfqHJZFYpukZKnnjAPpdg"
}

url = 'https://api.m.jd.com/api?appid=search-pc-java&t=1762231550830&client=pc&clientVersion=1.0.0&cthr=1&uuid=175628082811923751328&loginType=3&keyword=%E5%A4%9A%E6%A1%B6%E6%B4%97%E8%A1%A3%E6%9C%BA&functionId=pc_search_searchWare&body={%22enc%22:%22utf-8%22,%22pvid%22:%228b7c166b8309444aa6ad60cddf551712%22,%22area%22:%227_412_416_47178%22,%22page%22:1,%22new_interval%22:true,%22s%22:1}&x-api-eid-token=jdd03X7JXFWBZNZFJ3FUNHOR63PXBLGVQ5R5G7NRQFWCTXJ6ARQSL2XWQBGDERCM3VPT727EAT5G2YFMMCMGIKIXLLEMGU4AAAAM2JUXYKTYAAAAACB44TM2S3ZFMJMX&h5st=20251104124554870;gttta99ztdhtp668;f06cc;tk03wa8d11cb118nVwF40x2Jpgv6ALENgzrOqs1kA9YayYT2O5PDEE7fOotCsq7jwocmVxX24TFtrUlQtz6IyNVylCMX;2b9fa6e0fee735e61999ed230b87583ac64a24b0e16a5bd6ff1649951e650c1f;5.2;1762231550870;fZRCXZfTrJeFtAbIt4KTodbEtQqI-h-T-h6I-hfZXxfUB5_ZzUrJ-hfZXx-ZrhuJ8AOVqVeU9geUqNrUuhuUsV7J8ceToBeVvR7U7g_ZB5_ZxIdG6YLIqYfZB5hW-dOVrReIwBOTsJrJqdbU9Q_VAUeIpNeUsReIAMbVxF_J-h-T-VKJroLJ_YfZB5hW-h_ZB5_ZtN6J-hfZXx-Zup-VzN_ECMbG4IrKsB7ZB5_ZrYfZB5hW-VuRvZ_VfkMHuZfZnZPGyQ7GAY6ZBh-f1Z-VupLHKYfZnZ-IxYfZB5hWkgfZXZfHbYfZnZvVwN6J-hfZBh-f1ZeZnZPVwN6J-hfZBh-f1ROVB5_ZxdOE-YfZBhfZXxfT0h-T-ZOVsY7ZBhfZB5hW-VrU4Y_LdAsQoR9ZB5_Z0kbIzc7F-hfZBh-f1heZnZfTsY7ZBhfZB5hWxh-T-FOE-YfZBhfZXxPVvh-T-JOE-YfZBhfZXxfVB5_ZsN6J-hfZBh-f1heZnZfUsY7ZBhfZB5hWuNeZnZvVsY7ZBhfZB5hW-J_WwpfV-h-T-dOE-YfZBhfZXxfVB5_Z2E6ZBhfZB5hWsh-T-VaG-hfZBh-f1heZnZfG-hfZBh-f1heZnZfIqYfZBhfZX1aZnZfIzMbEpM7ZBh-f1taZB5BZwIcFSgaOsEKMn47ICQ7H-h-T-ZeF-hfZBh-fmg-T-haF-hfZXx-ZtJeDB1eUrpLHKgvTxpfVwhfMTgvFqkbIz8rM-h-T-dLEuYfZB5xD;a3904ec2805690f87522f897efde440213550f961d13f7e1b8b7b907f7a64830;gRaW989Gy8bE_oLE7w-Gy8rFvM7MtoLI4wrJ1R6G88bG_wPD9k7J1RLHxgKJ&t=1762231550892'
time.sleep(random.uniform(1, 3))
res = requests.get(url,headers=headers)
print(res.text,type(res))
print(res.status_code)